import 'package:flutter/material.dart';
import 'pages/index.dart';
import 'pages/ClassIn.dart';
import 'pages/LoginPage.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      // home: Scaffold(
      //   appBar: AppBar(
      //     title: Text("教学小栈"),
      //     centerTitle: true,
      //   ),
      //   body: Index(),
      // ),
      onGenerateRoute: (RouteSettings settings) {
        var routes = <String, WidgetBuilder>{
          "index": (context) => Index(settings.arguments),
          "/": (context) => LoginPage(),
          "class_in": (context) => ClassIn(),
        };
        WidgetBuilder builder = routes[settings.name];
        return MaterialPageRoute(builder: (context) => builder(context));
      },
    );
  }
}
